package com.wyz.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wyz.entity.Student;
import com.wyz.entity.Teacher;
import com.wyz.mapper.StudentMapper;
import com.wyz.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class StudentServiceImpl implements StudentService {
    @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
    @Autowired
    StudentMapper studentMapper;

    @Override
    public PageInfo<Student> findAll(int indexPage, int pageSize, String name, String grade) {
        Map map = new HashMap();
        map.put("name",name);
        map.put("grade",grade);
        PageHelper.startPage(indexPage,pageSize);
        return new PageInfo<Student>(studentMapper.findAll(map));
    }

    @Override
    public int add(Student student) {
        return studentMapper.add(student);
    }
}
